package cn.tedu.charging.device.controller;

import cn.tedu.charging.common.pojo.vo.StationDetailVO;
import cn.tedu.charging.common.pojo.vo.StationInfoVO;
import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.device.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StationController {
    @Autowired
    private StationService stationService;
    //获取范围内充电桩简要信息
    //中心点 lat lng
    //距离  写死 5000米
    @GetMapping("/device/station/near")
    public JsonResult<List<StationInfoVO>> nearbyStations(Double longitude,Double latitude,Double radius){
        //控制层返回什么 业务层封装什么
        List<StationInfoVO> vos=stationService.nearbyStations(longitude,latitude,radius);
        return JsonResult.ok(vos);
    }
    @GetMapping("/device/station/detail/{stationId}")
    public JsonResult<StationDetailVO> detailStation(@PathVariable Integer stationId){
        StationDetailVO vo=stationService.detailStation(stationId);
        return JsonResult.ok(vo);
    }
}
